package com.fg.fgmall.controller;

import com.fg.fgmall.common.R;
import com.fg.fgmall.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


//@Tag(name = "category api", description = "分类接口")
@RestController
public class CagetoryController {

    @Autowired
    private CategoryService categoryService;

    // 查询所有分类
    @RequestMapping("/categories")
//    @Operation(summary = "获得全部分类")
//    @ApiResponse(content = @Content(schema = @Schema(implementation = R.class)))
    public R selectAllCagetory() {
        try {
            List<Map<String, Object>> maps = categoryService.selectAllCategory();
            return R.ok(maps);
        } catch (Exception e) {
            return R.error();
        }
    }

}
